/*
 * oled.h
 *
 *  Created on: 
 *      Author: 
 */

#ifndef MAIN_OLED_H_
#define MAIN_OLED_H_


//////////////////////////////////////////////////////////////////////////////////
//  
//             
//              ----------------------------------------------------------------
//              GND
//              VCC  	3.3v
//              D0    	CLK
//              D1    	DIN
//              RES  	RES
//              DC      DC
//              CS      CS
//              ----------------------------------------------------------------
//******************************************************************************/
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "u8g2.h"
#include "u8x8.h"
#include "stdlib.h"
#include "driver/gpio.h"
#include "driver/spi_master.h"
#define u8 unsigned char
#define u32 unsigned int


//              GND
//              VCC  	3.3v
//              D0    	CLK
//              D1    	DIN
//              RES  	RES
//              DC      DC
//              CS      CS

#define PIN_OLED_CLK    ((gpio_num_t)(6))
#define PIN_OLED_DIN    ((gpio_num_t)(2))
#define PIN_OLED_RES    ((gpio_num_t)(1))
#define PIN_OLED_DC     ((gpio_num_t)(20))
#define PIN_OLED_CS     ((gpio_num_t)(10))
//-----------------OLED接口----------------
#define OLED_CS_Clr()  gpio_set_level(PIN_OLED_CS, 0)//CS
#define OLED_CS_Set()  gpio_set_level(PIN_OLED_CS, 1)

#define OLED_REST_Clr() gpio_set_level(PIN_OLED_RES, 0)//RES
#define OLED_REST_Set() gpio_set_level(PIN_OLED_RES, 1)

#define OLED_DC_Clr() gpio_set_level(PIN_OLED_DC, 0)//DC
#define OLED_DC_Set() gpio_set_level(PIN_OLED_DC, 1)

void u8g2Init(u8g2_t *u8g2);

void oledSpiInit(void);
void oledReset(void);
#endif /* MAIN_OLED_H_ */
